package cn.hyatt.auth.entity;

import cn.hyatt.core.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;

/**
 * 用户
 *
 * @author hyatt
 */
@Getter
@Setter
@TableName(value = "system_user")
@Schema(name = "用户")
public class SystemUser extends BaseEntity {

    @NotNull
    @TableField(value = "dept_id")
    @Schema(description = "所属部门")
    private Long deptId;

    @NotNull
    @Min(value = 8)
    @Max(value = 16)
    @TableField(value = "username")
    @Schema(description = "用户名")
    private String username;

    @NotNull
    @Min(value = 8)
    @Max(value = 32)
    @TableField(value = "password")
    @Schema(description = "密码")
    private String password;

    @NotNull
    @TableField(value = "nick_name")
    @Schema(description = "用户昵称")
    private String nickName;


    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$")
    @TableField(value = "phone")
    @Schema(description = "联系电话")
    private String phone;


    @Email
    @TableField(value = "email")
    @Schema(description = "电子邮箱")
    private String email;


    @NotNull
    @TableField(value = "enabled")
    @Schema(description = "是否启用：true启用 false未启用")
    private Boolean enabled;
}
